import type { LogLevel } from '../../lib/logger'
import { Logger } from '../../lib/logger'
import { LoggerDeduplicator } from '../../lib/logger_deduplicator'
import { APP_CONFIG } from './app'
import { BUILD_CONFIG } from './build'

const logger: Logger = new Logger({
  level: APP_CONFIG.logLevel as LogLevel, // 日志级别
  enabled: true, // 是否启用日志
  includeCaller: false, // 是否包含调用者信息
  clearStrategy: {
    type: 'time-based',
    days: 7,
  },
})
logger.setPrefix(BUILD_CONFIG.PROJECT_NAME)
export { logger }

export const loggerDeduplicator: LoggerDeduplicator = LoggerDeduplicator.getInstance()
